package com.zp.collection;

import java.util.ArrayList;
/**
 * 
 * @author zhangpeng
 *
 */
public class ArrayListTest3 {
	public static void main(String[] args) {
		
		ArrayList<Point> arraylist = new ArrayList<Point>();
		
		arraylist.add(new Point(1,2));
		arraylist.add(new Point(3,4));
		arraylist.add(new Point(5,6));
		
		for(int i=0;i<arraylist.size();i++){
			System.out.println(arraylist.get(i));
		}
		
		//未重写Point类中的toString()方法；
		//System.out.println(arraylist);
		//结果：[com.zp.collection.Point@c17164, com.zp.collection.Point@1fb8ee3, com.zp.collection.Point@61de33]
		
		//重写Point类中的toString()方法；
		System.out.println(arraylist);
		//结果：[x=1; y2;, x=3; y4;, x=5; y6;]
	}
}
